package com.jzo2o.customer.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jzo2o.customer.model.domain.WorkerCertification;
import com.jzo2o.customer.model.dto.WorkerCertificationUpdateDTO;
import com.jzo2o.customer.model.dto.request.WorkerCertificationAuditPageQueryReqDTO;
import com.jzo2o.customer.model.dto.response.RejectReasonResDTO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Update;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * <p>
 * 服务人员认证信息表 Mapper 接口
 * </p>
 *
 * @author itcast
 * @since 2023-09-06
 */
public interface WorkerCertificationMapper extends BaseMapper<WorkerCertification> {


    List<WorkerCertificationUpdateDTO> queryWorkList(WorkerCertificationAuditPageQueryReqDTO workerCertificationAuditPageQueryReqDTO);
    @Update("UPDATE worker_certification SET reject_reason = #{rejectReason}, audit_status = 1 WHERE id = #{id}")
    void updateCertificationStatus( Long id, @Param("rejectReason") String rejectReason);

    RejectReasonResDTO getRejectReason(Long userId);
    @Insert("UPDATE worker_certification SET audit_status = 0 WHERE id = #{userId}")
    void setAuditStatus(Long userId);
    @Insert("INSERT INTO worker_audit (worker_id) VALUES (#{userId})")
    void setAuditId(Long userId);
}
